# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def nav_link( text, controller, action=:index )
    link_to_unless_current text, :controller => controller, :action => action
  end

  # put this in the body after a form to set the input focus to a specific control id
  # at end of rhtml file: <%= set_focus_to_id 'form_field_label' %>
  def set_focus_to_id(id)
    javascript_tag("$('#{id}').focus()");
  end

  #http://snippets.dzone.com/posts/show/2255
  def getFormattedDateTime( t=nil)
    return t.to_datetime.strftime('%Y-%m-%d %H:%M:%S')
  end
end
